<template>
  <li>
    <div class="div-tag">
      <span>课程名称：语文</span>
      <span>课程费用：80元</span>
    </div>
    <div class="div-tag">
      <span>课程时长：一小时</span>
      <span>授课方式：面授</span>
    </div>
    <div class="footer-btn">
      <van-button color="#44AFC8" plain round @click="editUser('编辑课程')">编辑</van-button>
      <van-button color="#E44E58" plain round @click="del('语文')">删除</van-button>
    </div>
  </li>
</template>

<script>
export default {
  name: 'CourseList',
  mounted() {
  },
  methods: {
    editUser(title) {
      this.$router.push({
        path: '/AddCourse',
        query: {
          title,
          isForbidden: true // 控制addUser提交按钮是否可以点击
        }
      })
    },
    del(courseName) {
      this.Dialog.confirm({
        message: `是否确认删除<span style="color: red">${courseName}课程</span>的此条记录吗?`
      })
        .then(() => this.Toast('删除成功'))
        .catch(() => this.Toast('取消删除'))
    }
  }
}
</script>

<style scoped lang="less" rel="stylesheet/less">
li {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: #F5F1F0;
  height: 90px;
  margin-top: 8px;
  font-size: 12px;
  padding: 12px 15px;
  box-sizing: border-box;

  .div-tag {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .footer-btn {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;

    button {
      height: 22px;
    }

    button:nth-child(1) {
      margin-right: 15px;
    }
  }
}
</style>
